package collectiondemo;

//如何使用 Collection 和 Listiterator 类的 listIterator() 和 collection.reverse() 方法来反转集合中的元素：
public class Main6 {
    public static void main(String[] args) {
        String[] coins = {"A", "B", "C", "D", "E"};
        java.util.List l = new java.util.ArrayList();
        java.util.Collections.addAll(l, coins);
        java.util.ListIterator liter = l.listIterator();
        System.out.println("反转前");
        while (liter.hasNext())
            System.out.println(liter.next());
        java.util.Collections.reverse(l);
        liter = l.listIterator();
        System.out.println("反转后");
        while (liter.hasNext())
            System.out.println(liter.next());
    }
}
